const weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
export const MyPlugin = {
  install: (Vue, options) => {
    Vue.filter('filterDate', filterDate)
  }
}
const filterDate = (date) => {
  date = new Date(Number(date))
  var year = date.getFullYear()
  var month = date.getMonth() + 1
  var day = date.getDate()
  var hours = date.getHours()
  var minutes = date.getMinutes()
  var seconds = date.getSeconds()

  month = month.toString().length > 1 ? month : '0' + month
  day = day.toString().length > 1 ? day : '0' + day

  hours = hours.toString().length > 1 ? hours : '0' + hours
  minutes = minutes.toString().length > 1 ? minutes : '0' + minutes
  seconds = seconds.toString().length > 1 ? seconds : '0' + seconds

  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds} ${weeks[date.getDay()]}`
}

export default filterDate